<?php

	 require('../database/bd_connect.php');

//ALERTS		

//$wlan =	check_wlan($cpe);

//NOTICES
//$wlan_mode = check_wlan_mode($cpe);
//$wlan_channelmode = check_wlan_channelmode($cpe);
//$wlan_advertisement = check_wlan_advertisement($cpe);

if (isset($_GET['opt'])){	
	$cpe = $_GET['opt'] ;
	
	
	//ALERTS	
	function check_wlan($cpe){ 
		require('../database/bd_connect.php');
		//Wireless is disabled if different from 1 or Up return 1 if is enable 0 if disabled
		$sql = "SELECT COUNT(*) FROM cpe WHERE cpe_id=".$cpe." AND wlan_status='Up' AND wlan_enable=1;";			
		$result = $conn->query($sql);
		$row = mysqli_fetch_array($result);
		if ($row[0] != 1) {
			echo ('<div class="col-md-3" id="variance_alert2"><div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button><b>Alert! </b>Wireless is disabled!</div></div>');
		}
	}
	
	
	function check_wlan_radio($cpe){
		require('../database/bd_connect.php');
		//Wifi Radio is turned off if different from 1 return 1 if is enable 0 if disabled
		$sql = "SELECT COUNT(*) FROM cpe WHERE cpe_id=".$cpe." AND wlan_radioenable=1;";
		$result = $conn->query($sql);
		$row = mysqli_fetch_array($result);
		if ($row[0] != 1) {
			echo ('<div class="col-md-3" id="variance_alert2"><div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button><b>Alert! </b>Wifi Radio is turned off!</div></div>');
		}
	}
	check_wlan($cpe);
	check_wlan_radio($cpe);
}
?>
